﻿@using EquipmentManager.Entities
@model EquipmentManager.Models.CreateModel<User>

@{
    ViewBag.Title = "Редактировать пользователя " + Model.Instance.FullName;
}

@section menu {
    <section class="featured">
            <div class="master-menu">
                @{Html.RenderPartial("AdminMenu");}
            </div>
    </section>
}

<h2>Редактировать пользователя @Model.Instance.FullName</h2>

@using (Html.BeginForm("EditUser", "Admin", FormMethod.Post, new { @class = "" }))
{   
    @Html.HiddenFor(model => model.Instance.Id)
    @Html.HiddenFor(model => model.Instance.Status)
    @Html.HiddenFor(model => model.ParentId)
    @Html.HiddenFor(model => model.Instance.RegistredDate)
    
    <table class="bordered">
        <tr>
            <td class="vertical-header">Логин</td>
            <td>@Html.EditorFor(model => model.Instance.UserName, new { @class = "" })</td>
        </tr>
        <tr>
            <td class="vertical-header">ФИО</td>
            <td>@Html.EditorFor(model => model.Instance.FullName, new { @class = "" })</td>
        </tr>
        <tr>
            <td class="vertical-header">Пароль</td>
            <td>@Html.EditorFor(model => model.Instance.Password, new { @class = "" })</td>
        </tr>
        <tr>
            <td class="vertical-header">Роль</td>
            <td>@Html.DropDownListFor(model => model.Instance.Role, new SelectList(Enum.GetValues(typeof(UserRole))))</td>
        </tr>
    </table>
    
    @Html.ValidationSummary();

    <p>
        @Html.ActionLink("Отмена", "PostOffices", new { RegionId = @Model.ParentId }, new { @class = "common-btn-large BlueColor" }) <input type="submit" value="ОК" class="common-btn-large BlueColor" />
    </p>
}